<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
<script type="text/javascript">
	//预习冒泡排序， 对[5, 9, 7, 1, 3]排序

			let arr = [5, 9, 7, 1, 3]
		for(let i = 0; i < arr.length-1; i++){
			for(let j = 0; j < arr.length-i-1; j++){
				if(arr[j] > arr[j + 1]){
					let temp = arr[j]
					arr[j] = arr[j + 1]
					arr[j + 1] = temp
				}
			}
		}
		console.log(arr)
	//数组去重 var arr = [8, 6, 7, 8, 9, 10, 9, 1, 7, 2, 3
let arr = [8, 6, 7, 8, 9, 10, 9, 1, 7, 2, 3];
for (let i = 0; i < arr.length; i++) {
  for (let j = i + 1; j < arr.length; j++) {
    if (arr[i] === arr[j]) {
      arr.splice(j, 1); // 删除重复元素
      j--; // 删除元素后索引回退
    }
  }
}
console.log(arr);
</script>
</body>
</html>